import os

from django.test import TestCase

# Create your tests here.


if __name__ == '__main__':
    # 先导入一句话
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'BookSystem.settings')

    # 启动Django
    import django

    django.setup()
    from author.models import Author,AuthorDetail
    from book.models import Book
    from django.db.models import F, Q
    # data=Author.objects.get(pk='2')
    a='女'
    gender_date=Author.objects.first().gender_choices
    print(gender_date)
    for id,value in gender_date:
        if a==value:
            print(id)
            break

    # for i in author_date:
    #     a=i.get_gender_display()
    #     print(i.get_gender_display())
    #     for id,value in author_date.gender_choices:
    #         if a==value:
    #             print(id)
    #             break
    #         # print(id,value)
        # print(i.gender_choices)


